package com.cognitran.cssvalidator.ant.types;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.apache.tools.ant.types.DataType;

/**
 * The output type, that acts as a wrapper for a collection of output formats.
 * 
 * @author garethf
 */
public class Output extends DataType
{
	
	/** The directory that output will be written to. */
	private String dir;

    /** The language that this output format is required in. */
    private String language;
    
    /** The set of output formats. */
    private List<Format> formats = new ArrayList<Format>();


    /**
     * Get the directory that the output should be written to.
     * 
     * @return The directory that the output should be written to.
     */
    public String getDir()
    {
    	return dir;
    }
    
    
    /**
     * Set the directory to write output to.
     * 
     * @param dir The directory where output will be written.
     */
    public void setDir(final String dir)
    {
    	this.dir = dir;
    }
    
    
    /**
     * Add an output format to the format collection.
     * 
     * @param type The <code>format</code> ant type to add.
     */
    public void addConfiguredFormat(final Format format)
    {
    	formats.add(format);
    }
    
    
    /**
     * Get the language that this output is required in.
     * 
     * @return The language that this output will be formatted in.
     */
    public String getLanguage()
    {
    	return language;
    }

    
    /**
     * Set the language that output should be formatted in.
     * 
     * @param language The language that this output will be formatted in.
     */
    public void setLanguage(final String language)
    {
    	this.language = language;
    }
    
    
    /**
     * Get the set of required output formats.
     * 
     * @return A read-only set of output format types.
     */
    public List<Format> getOutputFormats()
    {
        return Collections.unmodifiableList(formats);
    }
    
}
